<?php

$con = mysql_connect("localhost","root","");
mysql_set_charset('utf8',$con);
if(!$con){
	echo "Ket noi khong thanh cong";
}
mysql_select_db("for_woman",$con);

$query = "Select ma.id,ma.name,fd.data,ma.group_id,CONCAT(SUBSTRING(ma.note,1,65),'...') as note
			from forwoman_monan ma
			Left Join phpviet_file f on f.id = ma.pic_id
            Left Join phpviet_file_data fd on fd.file_id = f.file_id
			where ma.sync_status=0";

$result = mysql_query($query);
$arr=array();

while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
	$row['data'] = base64_encode($row['data']);
    $arr[] = $row;

}
$arr1['post'] = $arr;

header('Content-type: application/json; charset=utf-8');
//header("Content-type: png");
echo json_encode($arr1);

?>
